import { get } from 'lodash-es'

export class MiniTicket {
  id?: string
  hotel_id?: string
  openid?: string
  ip_address?: string
  business_date?: string | Date
  description?: string
  mobile?: string
  image1?: string
  image2?: string
  image3?: string
  image4?: string
  images?: string[]
  status?: string
  comment?: string
  updated_id?: string
  created_at?: string
  updated_at?: string
  version?: number;

  [key: string]: any

  constructor(data?: MiniTicket) {
    this.init(data)
  }
}

MiniTicket.prototype.init = function init(data?: MiniTicket) {
  this.id = get(data, 'id')
  this.hotel_id = get(data, 'hotel_id', '')
  this.openid = get(data, 'openid', '')
  this.ip_address = get(data, 'ip_address')
  this.business_date = get(data, 'business_date')
  this.description = get(data, 'description')
  this.mobile = get(data, 'mobile')
  this.image1 = get(data, 'image1')
  this.image2 = get(data, 'image2')
  this.image3 = get(data, 'image3')
  this.image4 = get(data, 'image4')
  this.images = get(data, 'images', [])
  this.status = get(data, 'status')
  this.comment = get(data, 'comment')
  this.updated_id = get(data, 'updated_id')
  this.created_at = get(data, 'created_at')
  this.updated_at = get(data, 'updated_id')
  this.version = get(data, 'version')
}
